The present invention relates to the field of system management, and more specifically, to a computer-implemented method, a system and a computer program product for monitoring an application during its operation.
In the field of information technology and system management, Application Performance Management (APM) is used for the monitoring and management of performance and availability of software applications. APM is used to detect and diagnose complex application performance problems to maintain a predetermined level of service.
Program instrumentation are widely used in monitoring tools, optimization tools, and testing tools. Program instrumentation is a process of inserting additional statements into a program for the purpose of gathering information about dynamic behaviors of the program. The program instrumentation is executed during the operation of the program, so that the runtime information of the program can be collected and analyzed. Program instrumentation modifies binary code or byte code, to achieve its goals, such as performance analysis, code optimization, and coverage test analysis.
A simple Java program is shown as below, in which some statements are inserted in order to record the transaction operations, as shown by notes. Actually, all the instrumentations are performed with respect to binary code or byte code, instead of source code. The example code segment is used to just illustrate how code is modified logically.
 class Simple { int i; public void set (int i) {   runtimeRecorder.beforeTransaction(this);//inserted for monitoring a   transaction   synchronized(this) {this.i=i;}   runtimeRecorder.afterTransaction(this); //inserted for monitoring a   transaction }}
In an object-oriented programming environment, in order to capture system information that shows the time breakdown and count spent on various system related functionality, such as time spent in doing business logic and count in Enterprise JavaBeans (EJBs), database activity, messaging activity, etc., a monitoring tool will be tailored to the specific classes and methods. If the monitoring tool intends to monitor a Java Name Directory Interface (JNDI) transaction, the monitoring tool will be tailored to the classes and methods according to some configurations and rules, such as implementing the same interface. This system interface stands for a system activity such as the ones using Java Database Connectivity (JDBC), JNDI, Java Message Service (JMS) and etc. Tailored to a class means the class implements a dedicated system interface. Then, entry and exit callback methods are triggered in runtime to collect data of time consumption. The above code segment shows this kind of entry and exit callback methods. When the method Simple.set( ) is called, the entry callback method of runtimeRecorder.beforeTransaction( ) and the exit callback method of runtimeRecorder.afterTransaction( ) will be invoked.